<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/axios.min.js"></script>
    <link rel="stylesheet" href="../css/register.css">
</head>
<div class="bkImg">
    <img src="../images/swiper02-2.jpg" class="Img" />
    <div class="main">
        <h1>欢迎进入注册页面</h1>
        <p class="box"><span>用户名：</span><input type="text" name="" id="" /></p>
        <p class="box"><span>密码：</span><input type="password" name="" id="" /></p>
        <p class="bot">
            <input type="button" name="" id="" value="注册" />
            <a href="./login.html">
                <input type="button" name="" id="" value="返回登录" />
            </a>
            <a href="./index.html">
                <input type="button" name="" id="" value="返回首页" />
            </a>
        </p>

    </div>
</div>



<script>
    let ipts = document.querySelectorAll("input");
    ipts[2].onclick = function() {
        let username = ipts[0].value;
        let password = ipts[1].value;
        let regAPI = "http://jx.xuzhixiang.top/ap/api/reg.php";
        axios
            .get(regAPI, {
                params: {
                    username: username,
                    password: password,
                },
            })
            .then((res) => {
                console.log(res.data);
                alert(res.data.msg);
                if (res.data.code == 1) {
                    location.href = "login.html";
                }
            });
    };
</script>

<body>

</body>

</html>